package com.zhoug.viewpermission;




import android.content.Context;

import androidx.annotation.NonNull;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

/**
 * 定义数据库
 *
 * @Author HK-LJJ
 * @Date 2020/1/16
 * @Description
 */
@Database(version = MenuDatabase.VERSION_CODE,
        entities = {NavigationMenu.class}
)
public abstract class MenuDatabase extends RoomDatabase {
    public static final int VERSION_CODE = 1;
    private static final String TAG = ">>>MenuDatabase";
    public static final String DATABASE_NAME = "navigationMenu.db";
    private static MenuDatabase singleInstance;


    public static MenuDatabase getInstance() {
        if (null == singleInstance) {
            synchronized (MenuDatabase.class) {
                if (null == singleInstance) {
                    singleInstance = Room.databaseBuilder(ViewPermissionSdk.getAppContext(), MenuDatabase.class, DATABASE_NAME)
                            .fallbackToDestructiveMigration()
                            .build();
                }
            }
        }
        return singleInstance;
    }


    public abstract MenuDao getPageMenuDao();




}
